package cn.czh.feign;


import cn.czh.domain.Middle;
import cn.czh.domain.Movie;
import cn.czh.util.AjaxResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

@FeignClient(value = "movie-server")
public interface MovieFeignClient {

    /**
     * 查询所有
     * @return
     */
    @GetMapping("/movie/findAll")
    List<Movie> findAll();

    /**
     * 查询单个
     * @param id
     * @return
     */
    @GetMapping("/movie/getById/{id}")
    Movie getById(@PathVariable("id") Long id);

    /**
     * 购票
     * @param middle
     * @return
     */
    @PostMapping("/movie/buy")
    AjaxResult buy(Middle middle);

    /**
     * 随机赠送电影票
     * @return
     */
    @GetMapping("/movie/random")
    Movie random();

    /**
     * 新增或修改电影信息
     * @param movie
     */
    @PostMapping("/movie/addOrUpdate")
    void addOrUpdateMt(Movie movie);

    /**
     * 观看电影
     * @param middle
     * @return
     */
    @PostMapping("/movie/see")
    AjaxResult seeMovie(Middle middle);
}
